home *** CD-ROM | disk | FTP | other *** search
- Path: stdc.demon.co.uk!clive
- From: clive@stdc.demon.co.uk (Clive D.W. Feather)
- Newsgroups: comp.std.c
- Subject: Re: Binary Mode stdin/stdout
- Date: Wed, 7 Feb 1996 06:24:30 GMT
- Organization: Demon Internet Limited (personal account)
- Message-ID: <DME74w.4M4@stdc.demon.co.uk>
- References: <4f67kg$11g@cortex.dialin.rrze.uni-erlangen.de>
- Reply-To: clive@demon.net
- X-NNTP-Posting-Host: stdc.demon.co.uk
-
- In article <4f67kg$11g@cortex.dialin.rrze.uni-erlangen.de>,
- Markus Kuhn <mskuhn@cip.informatik.uni-erlangen.de> wrote:
- > Why isn't there a standard way of allowing an ISO C program to switch
- > the standard input and output into binary transparent mode (as with
- > the "b" flag in fopen()/freopen() for normal files)?
- >
- > Has this just been forgotten or is there a good technical reason?
-
- On some implementations, this decision has to be made at the time you
- open the file and can't be changed. For example, on OS/360 and its
- successors, text files might be VB80, while binary files will be U508,
- or whatever. The former is stored as:
-
- <4 byte value N1> <N1 bytes of text forming a line>
- <4 byte value N2> <N1 bytes of text forming a line>
- <4 byte value N3> <N1 bytes of text forming a line>
- ...
-
- (note that there are no newline characters) and the latter as
-
- <4 byte value N1> <N1 bytes of data> <508-N1 bytes ignored>
- <4 byte value N2> <N1 bytes of data> <508-N1 bytes ignored>
- <4 byte value N3> <N1 bytes of data> <508-N1 bytes ignored>
- ...
-
- (data is read and written in 512 byte units). How do you switch these ?
-
- --
- Clive D.W. Feather | If you lie to the compiler,
- cdwf@cityscape.co.uk (work, preferred) | it will get its revenge.
- clive@stdc.demon.co.uk (home) | - Henry Spencer
-